<template>
  <div>
    <div style="background: #e8f1f8">
      <div class="det_tab">
        <div class="det_tab_item">
          <eagle-cell-group :border="border">
            <eagle-input
              label="有限空间编号："
              :value="form.LSCCode ? form.LSCCode : '无'"
              readonly
            ></eagle-input>
            <eagle-input
              label="有限空间名称："
              :value="form.Name ? form.Name : '无'"
              readonly
            ></eagle-input>
            <eagle-input
              label="有限空间位置："
              :value="form.Position ? form.Position : '无'"
              readonly
            ></eagle-input>
            <eagle-input
              label="责任人"
              :value="form.ResponsibleChnName ? form.ResponsibleChnName : '无'"
              readonly
            ></eagle-input>
            <eagle-input
              label="所属部门"
              :value="
                form.ResponsibleDeptName ? form.ResponsibleDeptName : '无'
              "
              readonly
            ></eagle-input>
            <eagle-input
              label="识别人"
              :value="form.DiscernChnName ? form.DiscernChnName : '无'"
              readonly
            ></eagle-input>
            <eagle-input
              label="有限空间类型"
              :value="
                form.LimitedSpaceTypeName ? form.LimitedSpaceTypeName : '无'
              "
              readonly
            ></eagle-input>
            <eagle-input
              label="危害因素"
              :value="HazardFactor? HazardFactor : '无'"
              readonly
            ></eagle-input>
            <eagle-input
              label="事故及后果"
              :value="form.Accident ? form.Accident : '无'"
              readonly
            ></eagle-input>
            <eagle-input
              label="作业主体"
              :value="form.OpSubject ? form.OpSubject : '无'"
              readonly
            ></eagle-input>
            <eagle-input name="Attachs" label="警示标志">
              <template #input>
                <eagle-image-preview
                  :images="form.WarningMark"
                ></eagle-image-preview>
              </template>
            </eagle-input>
            <eagle-input name="Attachs" label="现场图片">
              <template #input>
                <eagle-image-preview
                  :images="form.ScenePicture"
                ></eagle-image-preview>
              </template>
            </eagle-input>
            <eagle-input
              label="备注"
              :value="form.Remarks ? form.Remarks : '无'"
              readonly
            ></eagle-input>
          </eagle-cell-group>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getDate } from "@/utils/getDate";
import { getDuplicateItemName } from "@/utils/util";
// import { deepClone } from "@/utils";
export default {
  components: {},
  data() {
    return {
      baseUrl: process.env.VUE_APP_BASE_API,
      id: this.$route.query.id,
      border: false,
      form: {},
      total: 0,
      show: false,
      PlanTypeName: "无",
      HazardFactorList: [],
      HazardFactor:"无"
    };
  },
  created() {
    this.geDetail();
    console.log("created");
  },
  activated() {
    console.log("activated");
  },
  methods: {
    // 获取详情
    geDetail() {
      let _this = this;
      _this.$axios
        .get("/OperationLimitedSpace/GetDetail", { params: { id: this.id } })
        .then((res) => {
          _this.form = res.data;
          _this.HazardFactorList;
          //危害因素
          if (
            res.data.HazardFactorList &&
            res.data.HazardFactorList.length > 0
          ) {
           this.HazardFactorNameList= getDuplicateItemName(res.data.HazardFactor ,res.data.HazardFactorList)
           this.HazardFactor=this.HazardFactorNameList.toString()
          }
        });
    },

  },
};
</script>

<style lang="less">
</style>
